Skip to content

plugin/bound: cancel deferred select binding on disposal - #72

Merged
rameel merged 1 commit into
mainfrom
bound/select-disposal
Oct 25, 2026
Merged

rameel merged 1 commit into
mainfrom
bound/select-disposal

Conversation

@rameel

@rameel rameel commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

For <select>, x-bound sets up its effect and change listener in a setTimeout, so that options rendered by x-for exist by then. If the element was destroyed before the timer fired, for example by an x-if toggled within the same tick, both were created after the directive's cleanups had already run and were never released: the detached <select> kept following the bound property and writing it back on change.

Clear the timer on cleanup.

For `<select>`, x-bound sets up its effect and change listener in a
setTimeout, so that options rendered by x-for exist by then. If the
element was destroyed before the timer fired, for example by an x-if
toggled within the same tick, both were created after the directive's
cleanups had already run and were never released: the detached select
kept following the bound property and writing it back on change.

Clear the timer on cleanup.
@github-actions

Copy link
Copy Markdown

📦 Bundle size comparison

Name Size Gzip Brotli Δ
alpinegear-bound.esm.min.js 3.94 KiB (+31 B) 1.81 KiB (+10 B) 1.57 KiB (+13 B) 🔴
alpinegear-bound.min.js 3.98 KiB (+31 B) 1.83 KiB (+12 B) 1.58 KiB (+8 B) 🔴
alpinegear-destroy.esm.min.js 128 B 123 B 91 B
alpinegear-destroy.min.js 191 B 167 B 123 B
alpinegear-dialog.esm.min.js 1.75 KiB 951 B 811 B
alpinegear-dialog.min.js 1.79 KiB 967 B 822 B
alpinegear-format.esm.min.js 1.18 KiB 645 B 579 B
alpinegear-format.min.js 1.25 KiB 680 B 587 B
alpinegear-fragment.esm.min.js 1.51 KiB 785 B 667 B
alpinegear-fragment.min.js 1.57 KiB 817 B 700 B
alpinegear-hotkey.esm.min.js 1.97 KiB 1.08 KiB 964 B
alpinegear-hotkey.min.js 2.03 KiB 1.10 KiB 996 B
alpinegear-main.esm.min.js 7.75 KiB (+31 B) 3.17 KiB (+8 B) 2.80 KiB (+16 B) 🔴
alpinegear-main.min.js 7.71 KiB (+31 B) 3.11 KiB (+8 B) 2.74 KiB (+8 B) 🔴
alpinegear-markdown.esm.min.js 19.27 KiB 7.26 KiB 6.61 KiB
alpinegear-markdown.min.js 19.32 KiB 7.27 KiB 6.63 KiB
alpinegear-match.esm.min.js 1.98 KiB 1004 B 868 B
alpinegear-match.min.js 2.05 KiB 1.01 KiB 897 B
alpinegear-router.esm.min.js 9.40 KiB 4.03 KiB 3.59 KiB
alpinegear-router.min.js 9.42 KiB 4.04 KiB 3.60 KiB
alpinegear-safehtml.esm.min.js 806 B 543 B 457 B
alpinegear-safehtml.min.js 853 B 569 B 485 B
alpinegear-template.esm.min.js 421 B 294 B 219 B
alpinegear-template.min.js 483 B 326 B 246 B
alpinegear-typegrab.esm.min.js 471 B 333 B 277 B
alpinegear-typegrab.min.js 509 B 348 B 294 B
alpinegear-when.esm.min.js 1.71 KiB 883 B 761 B
alpinegear-when.min.js 1.77 KiB 914 B 787 B

@rameel
rameel merged commit b566f80 into main Oct 25, 2026
2 checks passed
@rameel
rameel deleted the bound/select-disposal branch October 25, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant